package com.person.leetcode.editor.cn;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.StringJoiner;

/**
 * 824.山羊拉丁文
 * 2022-04-21 11:31:37
 **/
public class Sequence_0824_GoatLatin {
    public static void main(String[] args) {
        Solution solution = new Sequence_0824_GoatLatin().new Solution();
        Character c = 'a';
        String s = "a";
        System.out.println(s.equals(c.toString()));
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public String toGoatLatin(String seq) {
            HashSet<String> set = new HashSet<>();
            set.add("a");
            set.add("e");
            set.add("i");
            set.add("o");
            set.add("u");
            set.add("A");
            set.add("E");
            set.add("I");
            set.add("O");
            set.add("U");
            //辅音开头,移除首个,添置后尾
            //加ma
            //根据位置加a,从1开始
            String[] s = seq.split(" ");
            for (int i = 0; i < s.length; i++) {
                StringBuilder builder = new StringBuilder();
                Character c = s[i].charAt(0);
                if (set.contains(c.toString())){
                    //元音
                }else{
                    //辅音
                    s[i]=s[i].substring(1)+c;
                }
                builder.append("ma");
                for (int j = 0; j < i+1; j++) {
                    builder.append("a");
                }
                s[i] = s[i] +builder.toString();
            }
//            StringJoiner stringJoiner = new StringJoiner(" ");
//            for (String e : s) {
//                stringJoiner.add(e);
//            }
//            return stringJoiner.toString();
            for (int i = 0; i < s.length; i++) {
                if (0 == i){
                    seq=s[i];
                }else{
                    seq=seq+" "+s[i];
                }
            }
            return seq;
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}
